<?php
use Imi\Server\Type;

// 注释项代表可省略的，使用默认值
return [
    // 项目根命名空间
    'namespace'    =>    'ImiDemo\UdpDemo',
    // 扫描目录
    'beanScan'    =>    [
    ],
    // 主服务器配置，提供websocket服务
    'mainServer'    =>    [
        'namespace'    =>    'ImiDemo\UdpDemo\MainServer',
        'type'        =>    Type::UDP_SERVER,
        'host'        =>    '0.0.0.0',
        'port'        =>    8087,
        'configs'    =>    [
            'reactor_num'        =>    2,
            'worker_num'        =>    2,
            'task_worker_num'    =>    8,
        ],
        // 数据处理器
        'dataParser'    =>    Imi\Server\DataParser\JsonObjectParser::class,
    ],
    // 配置文件
    'configs'    =>    [
        'beans'        =>    __DIR__ . '/beans.php',
    ],
    'pools'    =>    [
        'redis'    =>    [
            'sync'    =>    [
                'pool'    =>    [
                    'class'        =>    \Imi\Redis\SyncRedisPool::class,
                    'config'    =>    [
                        'maxResources'    =>    5,
                        'minResources'    =>    1,
                    ],
                ],
                'resource'    =>    [
                    'host'    =>    '127.0.0.1',
                    'post'    =>    6379,
                    // 密码
                    // 'password'    =>    '',
                    // 第几个库
                    // 'db'    =>    0,
                ]
            ],
            'async'    =>    [
                'pool'    =>    [
                    'class'        =>    \Imi\Redis\CoroutineRedisPool::class,
                    'config'    =>    [
                        'maxResources'    =>    5,
                        'minResources'    =>    1,
                    ],
                ],
                'resource'    =>    [
                    'host'    =>    '127.0.0.1',
                    'post'    =>    6379,
                    // 密码
                    // 'password'    =>    '',
                    // 第几个库
                    // 'db'    =>    0,
                ]
            ],
        ],
    ],
    'caches'    =>    [
        // 文件缓存
        'f1'    =>    [
            'handlerClass'    =>    \Imi\Cache\Handler\File::class,
            'option'        =>    [
                'savePath'    =>    dirname(__DIR__, 3) . '/cache',
            ],
        ],
        // redis缓存
        'r1'    =>    [
            'handlerClass'    =>    \Imi\Cache\Handler\Redis::class,
            'option'        =>    [
                'poolName'    =>    'redis',
            ],
        ],
    ],
];